package org.cargloss.cp.controller.modul.menus;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.cargloss.cp.model.Menus;

import util.hibernate.DAO;

import com.opensymphony.xwork2.ActionSupport;

public class ActionJsonMap extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Map<Integer, String> listMenus = new HashMap<Integer, String>();

	// private List<Menus> listMenus;
	@SuppressWarnings("unchecked")
	public String execute() {
		DAO<Integer> dao = new DAO<Integer>();
		List<Menus> list = (List<Menus>) dao.findAll(Menus.class);
		listMenus.put(0,"Parent");
		for (Menus f : list) {
			listMenus.put(f.getId(), f.getName());
		}
		dao.close();
		return SUCCESS;
	}

	public Map<Integer, String> getListMenus() {
		return listMenus;
	}

	public void setListMenus(Map<Integer, String> listMenus) {
		this.listMenus = listMenus;
	}

}
